--[[
	Project:		TruRP
	Author:			Martin 'Ploo' Pucilowski
	File:			items.lua
	Date:			02/2010
	Description:	
--]]

local Interactions = {
	Eat,
	Drink,
	Use,
	Examine,
	Drop
}

function CreateWorldItem( class, pos, ang, quantity )
	if not ValidItem( class ) then return end

	local ent = ents.Create( "item" )
	ent:SetItem( class, quantity or 1 )
	ent:SetPos( pos )
	ent:SetAngles( ang or Angle(0,0,0) )
	ent:Spawn()
	
	timer.Simple(0.5, function()
		ent:SyncItem()
	end )
	
	return ent
end

concommand.Add("RP_WorldCreateItem", function( ply, cmd, args)
	local class = args[1]
	local pos = ply:TraceDropPos()
	local ang = Angle(0,0,0)
	local quantity = tonumber(args[2]) or 1
	
	CreateWorldItem( class, pos, ang, quantity )
end )